package com.sina.weibo;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AbsListView.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.sina.weibo.models.User;
import com.sina.weibo.view.BaseLayout;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public abstract class HomeListBaseActivity extends BaseActivity
{
  public final int WEIBO_LOADMORE = 0;
  public final int WEIBO_RELOAD = 1;
  protected long lastestItemTime = 0L;
  protected List<?> mBackupList;
  protected boolean mBeReload = 0;
  protected String mCacheDir;
  protected List<?> mList;
  private LinearLayout mLoadmoreItem;
  public int mNewCount = 0;
  protected MainTabActivity mParent;
  private ProgressBar mProgressBar;
  private BroadcastReceiver mReceiver;
  private LinearLayout mReloadItem;
  public boolean mUpdating = 0;
  protected ListView mlvBase;
  public boolean reloadBegine = 0;
  protected TextView tvTitleBarInfo;

  public HomeListBaseActivity()
  {
    HomeListBaseActivity.1 local1 = new HomeListBaseActivity.1(this);
    this.mReceiver = local1;
  }

  public void deleteList(List<?> paramList)
  {
    if (paramList == null)
      ArrayList localArrayList = new ArrayList();
    while (true)
    {
      return;
      paramList.clear();
    }
  }

  protected View getLoadMoreView()
  {
    return this.mLoadmoreItem;
  }

  protected View getReloadView()
  {
    return this.mReloadItem;
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    if (paramInt2 != -1);
    while (true)
    {
      return;
      SharedPreferences localSharedPreferences = getSharedPreferences("weibo", 0);
      StaticInfo.mUsername = localSharedPreferences.getString("username", "");
      StaticInfo.mPassword = localSharedPreferences.getString("password", "");
      StaticInfo.mUser = Utils.loadUserFile(this.mCacheDir);
      switch (paramInt1)
      {
      default:
        break;
      case 0:
        if (paramIntent != null)
          continue;
        switch (MainTabActivity.mMode)
        {
        case 1:
        case 2:
        case 3:
        default:
          List localList1 = this.mList;
          deleteList(localList1);
          break;
        case 0:
          String str1 = this.mCacheDir;
          User localUser1 = StaticInfo.mUser;
          List localList2 = Utils.loadHomeListFile(str1, localUser1);
          this.mList = localList2;
          break;
        case 5:
          String str2 = this.mCacheDir;
          User localUser2 = StaticInfo.mUser;
          List localList3 = Utils.loadAtListFile(str2, localUser2);
          this.mList = localList3;
          break;
        case 4:
          String str3 = this.mCacheDir;
          User localUser3 = StaticInfo.mUser;
          List localList4 = Utils.loadCommentMessageListFile(str3, localUser3);
          this.mList = localList4;
          break;
        case 6:
          String str4 = this.mCacheDir;
          User localUser4 = StaticInfo.mUser;
          List localList5 = Utils.loadMessageListFile(str4, localUser4);
          this.mList = localList5;
        }
      }
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setView(2130903060);
    this.reloadBegine = 0;
    RelativeLayout localRelativeLayout = (RelativeLayout)findViewById(2131624129);
    this.titleBar = localRelativeLayout;
    TextView localTextView1 = (TextView)findViewById(2131624131);
    this.tvTitleBarInfo = localTextView1;
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("com.sina.weibo.action.SWITCHUSER");
    BroadcastReceiver localBroadcastReceiver = this.mReceiver;
    Intent localIntent = registerReceiver(localBroadcastReceiver, localIntentFilter);
    ProgressBar localProgressBar = new ProgressBar(this, null, 16843400);
    this.mProgressBar = localProgressBar;
    LinearLayout localLinearLayout1 = new LinearLayout(this);
    this.mReloadItem = localLinearLayout1;
    LinearLayout localLinearLayout2 = new LinearLayout(this);
    this.mLoadmoreItem = localLinearLayout2;
    ListView localListView = (ListView)findViewById(2131624038);
    this.mlvBase = localListView;
    this.mlvBase.setBackgroundColor(-1);
    LinearLayout localLinearLayout3 = this.mReloadItem;
    Drawable localDrawable1 = getResources().getDrawable(2130837963);
    localLinearLayout3.setBackgroundDrawable(localDrawable1);
    LinearLayout localLinearLayout4 = this.mLoadmoreItem;
    Drawable localDrawable2 = getResources().getDrawable(2130837963);
    localLinearLayout4.setBackgroundDrawable(localDrawable2);
    this.mReloadItem.setOrientation(0);
    this.mLoadmoreItem.setOrientation(0);
    this.mReloadItem.setGravity(17);
    this.mLoadmoreItem.setGravity(17);
    this.mReloadItem.removeAllViews();
    this.mLoadmoreItem.removeAllViews();
    LinearLayout localLinearLayout5 = this.mReloadItem;
    View localView1 = setTextView(2131427374);
    localLinearLayout5.addView(localView1);
    LinearLayout localLinearLayout6 = this.mLoadmoreItem;
    View localView2 = setTextView(2131427442);
    localLinearLayout6.addView(localView2);
    setProgressBarIndeterminateVisibility(0);
    String str1 = getCacheDir().getPath();
    this.mCacheDir = str1;
    if (StaticInfo.mUser != null)
    {
      String str2 = this.mCacheDir;
      User localUser = StaticInfo.mUser;
      StaticInfo.mTotals = Utils.loadTotalFile(str2, localUser);
    }
    if (StaticInfo.mTotals == null)
      StaticInfo.mTotals = new int[12];
    do
    {
      MainTabActivity localMainTabActivity = (MainTabActivity)getParent();
      this.mParent = localMainTabActivity;
      TextView localTextView2 = this.tvTitleBarInfo;
      HomeListBaseActivity.2 local2 = new HomeListBaseActivity.2(this);
      localTextView2.setOnClickListener(local2);
      return;
    }
    while (StaticInfo.mTotals.length == 12);
    int[] arrayOfInt = new int[12];
    int i = 0;
    while (true)
    {
      int j = StaticInfo.mTotals.length;
      if (i >= j)
      {
        StaticInfo.mTotals = arrayOfInt;
        break;
      }
      int k = StaticInfo.mTotals[i];
      arrayOfInt[i] = k;
      i += 1;
    }
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131558401, paramMenu);
    return true;
  }

  protected void onDestroy()
  {
    BroadcastReceiver localBroadcastReceiver = this.mReceiver;
    unregisterReceiver(localBroadcastReceiver);
    super.onDestroy();
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    int i;
    switch (paramMenuItem.getItemId())
    {
    default:
      i = 1;
    case 2131624240:
    case 2131624239:
    case 2131624237:
    case 2131624238:
    case 2131624236:
    case 2131624241:
    }
    while (true)
    {
      return i;
      Intent localIntent1 = new Intent(this, AboutActivity.class);
      startActivity(localIntent1);
      break;
      Intent localIntent2 = Utils.sendFeedback(this);
      startActivity(localIntent2);
      break;
      Intent localIntent3 = new Intent(this, AccountManager.class);
      this.mParent.startActivity(localIntent3);
      i = 1;
      continue;
      Intent localIntent4 = new Intent(this, UserInfoActivity2.class);
      Intent localIntent5 = localIntent4.putExtra("uid", "1781379945");
      String str1 = getString(2131427666);
      Intent localIntent6 = localIntent4.putExtra("nick", str1);
      String str2 = StaticInfo.mUser.uid;
      Intent localIntent7 = localIntent4.putExtra("myuid", str2);
      Intent localIntent8 = localIntent4.putExtra("vip", 1);
      startActivity(localIntent4);
      break;
      MainTabActivity.mPrefNotifyNewblog = 0;
      MainTabActivity.mPrefNotifyComment = 0;
      MainTabActivity.mPrefNotifyMessage = 0;
      MainTabActivity.mPrefNotifyAt = 0;
      MainTabActivity.mPrefNotifyFans = 0;
      MainTabActivity.mPrefAutoCheck = 0;
      MainTabActivity localMainTabActivity = this.mParent;
      Intent localIntent9 = new Intent(this, SettingsPref.class);
      localMainTabActivity.startActivity(localIntent9);
      i = 1;
      continue;
      AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(this);
      AlertDialog.Builder localBuilder2 = localBuilder1.setTitle(2131427444).setIcon(2130837926).setCancelable(0);
      HomeListBaseActivity.3 local3 = new HomeListBaseActivity.3(this);
      AlertDialog.Builder localBuilder3 = localBuilder2.setPositiveButton(2131427441, local3);
      HomeListBaseActivity.4 local4 = new HomeListBaseActivity.4(this);
      AlertDialog.Builder localBuilder4 = localBuilder3.setNegativeButton(2131427436, local4);
      AlertDialog localAlertDialog = localBuilder1.show();
      i = 1;
    }
  }

  protected void onPause()
  {
    if (StaticInfo.mUser != null)
    {
      int i = MainTabActivity.mMode;
      String str = this.mCacheDir;
      User localUser = StaticInfo.mUser;
      Utils.saveModeFile(i, str, localUser);
    }
    super.onPause();
  }

  public boolean onPrepareOptionsMenu(Menu paramMenu)
  {
    MenuItem localMenuItem1 = paramMenu.findItem(2131624241);
    if (StaticInfo.mUser != null)
      MenuItem localMenuItem2 = localMenuItem1.setEnabled(1);
    while (true)
    {
      return true;
      MenuItem localMenuItem3 = localMenuItem1.setEnabled(0);
    }
  }

  protected void onResume()
  {
    super.onResume();
    if (this.mlvBase != null)
    {
      ListView localListView = this.mlvBase;
      boolean bool = SettingsPref.isFastScrollOn(this);
      localListView.setFastScrollEnabled(bool);
    }
  }

  protected void reloadBegine(int paramInt)
  {
    this.reloadBegine = 1;
    if (getClass().equals(HomeListActivity.class))
    {
      this.ly.progressButton.setVisibility(0);
      this.ly.rightButton.setVisibility(8);
      this.ly.leftButton.setEnabled(0);
    }
    switch (paramInt)
    {
    default:
    case 0:
    case 1:
    }
    while (true)
    {
      return;
      this.mLoadmoreItem.removeAllViews();
      LinearLayout localLinearLayout1 = this.mLoadmoreItem;
      View localView1 = setTextView(2131427442);
      localLinearLayout1.addView(localView1);
      LinearLayout localLinearLayout2 = this.mLoadmoreItem;
      ProgressBar localProgressBar1 = this.mProgressBar;
      localLinearLayout2.addView(localProgressBar1);
      continue;
      this.mReloadItem.removeAllViews();
      LinearLayout localLinearLayout3 = this.mReloadItem;
      View localView2 = setTextView(2131427422);
      localLinearLayout3.addView(localView2);
      LinearLayout localLinearLayout4 = this.mReloadItem;
      ProgressBar localProgressBar2 = this.mProgressBar;
      localLinearLayout4.addView(localProgressBar2);
    }
  }

  protected void reloadEnd(int paramInt)
  {
    this.reloadBegine = 0;
    if (getClass().equals(HomeListActivity.class))
    {
      this.ly.progressButton.setVisibility(8);
      this.ly.rightButton.setVisibility(0);
      this.ly.leftButton.setEnabled(1);
    }
    this.mLoadmoreItem.removeAllViews();
    LinearLayout localLinearLayout1 = this.mLoadmoreItem;
    View localView1 = setTextView(2131427442);
    localLinearLayout1.addView(localView1);
    this.mReloadItem.removeAllViews();
    LinearLayout localLinearLayout2 = this.mReloadItem;
    View localView2 = setTextView(2131427374);
    localLinearLayout2.addView(localView2);
  }

  protected abstract void reloadList();

  public View setTextView(int paramInt)
  {
    TextView localTextView = new TextView(this);
    ((TextView)localTextView).setText(paramInt);
    ((TextView)localTextView).setGravity(17);
    ((TextView)localTextView).setTextSize(18.0F);
    AbsListView.LayoutParams localLayoutParams = new android/widget/AbsListView$LayoutParams;
    if ((paramInt == 2131427422) || (paramInt == 2131427442));
    for (int i = -1; ; i = -1)
    {
      int j = getResources().getDimensionPixelSize(2131296262);
      localLayoutParams.<init>(i, j);
      ((TextView)localTextView).setLayoutParams(localLayoutParams);
      ((TextView)localTextView).setTextColor(-16777216);
      return localTextView;
    }
  }

  public View setTextView(String paramString)
  {
    TextView localTextView = new TextView(this);
    ((TextView)localTextView).setText(paramString);
    ((TextView)localTextView).setGravity(17);
    ((TextView)localTextView).setTextSize(18.0F);
    AbsListView.LayoutParams localLayoutParams = new android/widget/AbsListView$LayoutParams;
    String str1 = getString(2131427422);
    if (!paramString.equals(str1))
    {
      String str2 = getString(2131427442);
      if (!paramString.equals(str2))
        break label119;
    }
    label119: for (int i = -1; ; i = -1)
    {
      int j = getResources().getDimensionPixelSize(2131296262);
      localLayoutParams.<init>(i, j);
      ((TextView)localTextView).setLayoutParams(localLayoutParams);
      ((TextView)localTextView).setTextColor(-16777216);
      return localTextView;
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     com.sina.weibo.HomeListBaseActivity
 * JD-Core Version:    0.6.0
 */